
/**
 * 
 * @authors Your Name (you@example.org)
 * @date    2018-11-21 09:12:27
 * @version $Id$
 */
var $ = jquery = layui.jquery;
var layer = layui.layer;


$("#addClassifyBt").click(function(){
	layer.open({
        type: 1,
        title:"添加分类",
        content: $('#controlAddClassify'),
        area:["500px","300px"],
        btn: ['确定', '取消'],
        yes: function(index, layero){
           alert("点击了确认");
          layer.close(index); 
        }
   });
})


$("body").on("click","#classifyTable .del",function(){
	  layer.confirm('确定删除此条吗?', {icon: 3, title:'提示'}, function(index){
	  	  alert("点击了确认");
          layer.close(index);
        });
})


$("body").on("click","#book_listTable .on",function(){
    layer.confirm('确定<span class="green">下架</span> 哈默擂台吗?', {icon: 3, title:'提示'}, function(index){
        alert("点击了确认");
          layer.close(index);
    });
})

$("body").on("click","#book_listTable .off",function(){
   layer.confirm('确定<span class="red">上架</span> 射雕英雄传吗?', {icon: 3, title:'提示'}, function(index){
        alert("点击了确认");
          layer.close(index);
    });
})



$("body").on("click","#book_listTable .del",function(){
    layer.confirm('确定删除此条吗?', {icon: 3, title:'提示'}, function(index){
        alert("点击了确认");
          layer.close(index);
        });
})



$("#addmanageBtn").click(function(){
   layer.open({
        type: 1,
        title:"添加管理员",
        content: $('#controladdmanage'),
        area:["500px","430px"],
        btn: ['确定', '取消'],
        yes: function(index, layero){
           alert("点击了确认");
          layer.close(index); 
        }
   });
})




$("body").on("click","#use_manageTable .del",function(){
    layer.confirm('确定 <span class="red">取消</span> 该用户管理员权限吗?', {icon: 3, title:'提示'}, function(index){
        alert("点击了确认");
          layer.close(index);
        });
})


$("body").on("click","#use_manageTable .edit",function(){
    layer.open({
        type: 1,
        title:"修改权限",
        content: $('#controlEditUse'),
        area:["500px","400px"],
        btn: ['确定', '取消'],
        yes: function(index, layero){
           alert("点击了确认");
          layer.close(index); 
        }
   });
})



// use_shcoll
$("#addschoolBtn").click(function(){
    layer.open({
        type: 1,
        title:"添加学校",
        content: $('#controladdSchool'),
        area:["600px","400px"],
        btn: ['确定', '取消'],
        yes: function(index, layero){
           alert("点击了确认");
          layer.close(index); 
        }
   });
})

$("body").on("click","#use_schoolTable .edit",function(){
    layer.open({
        type: 1,
        title:"编辑学校",
        content: $('#controlEditSchool'),
        area:["600px","400px"],
        btn: ['确定', '取消'],
        yes: function(index, layero){
           alert("点击了确认");
          layer.close(index); 
        }
   });
})

$("body").on("click","#use_schoolTable .del",function(){
    layer.confirm('确认要 <span class="red">禁用</span> 该学校/用户所有账号吗？', {icon: 3, title:'提示'}, function(index){
        alert("点击了确认");
          layer.close(index);
        });
})

$("body").on("click","#use_schoolTable .add",function(){
    layer.open({
        type: 1,
        title:"添加用户",
        content: $('#controladdSchoolUser'),
        area:["500px","400px"],
        btn: ['确定', '取消'],
        yes: function(index, layero){
           alert("点击了确认");
          layer.close(index); 
        }
   });
})



$("body").on("click","#use_userTable .off",function(){
    layer.confirm('确认要将 <span class="blue">xxx</span> 设置为学校管理员吗？', {icon: 3, title:'提示'}, function(index){
        alert("点击了确认");
          layer.close(index);
        });
})

$("body").on("click","#use_userTable .on",function(){
    layer.confirm('确认要 <span class="red">取消</span> 用户 <span class="blue">xxx</span> 的学校管理权限吗？', {icon: 3, title:'提示'}, function(index){
        alert("点击了确认");
          layer.close(index);
        });
})


$("body").on("click","#use_userTable .del",function(){
    layer.confirm('确认要 <span class="red">禁用</span> 该用户账号吗？', {icon: 3, title:'提示'}, function(index){
        alert("点击了确认");
          layer.close(index);
        });
})

$("body").on("click","#use_userTable .reset",function(){
    layer.confirm('确认要 <span class="blue">重置</span> 该用户密码吗？</br>重置后密码为123456', {icon: 3, title:'提示'}, function(index){
        alert("点击了确认");
          layer.close(index);
        });
})


//index_banner

$("#addBannerBt").click(function(){
  layer.open({
        type: 1,
        title:"添加推荐",
        content: $('#controladdIndexBanner'),
        area:["500px","540px"],
        btn: ['确定', '取消'],
        yes: function(index, layero){
           alert("点击了确认");
          layer.close(index); 
        }
   });
})
    




$("body").on("click","#index_bannerTable .del",function(){
    layer.confirm('确认要 <span class="red">取消</span> 该推荐吗？', {icon: 3, title:'提示'}, function(index){
        alert("点击了确认");
          layer.close(index);
        });
})


$("body").on("click","#index_bannerTable .edit",function(){
    layer.open({
        type: 1,
        title:"添加推荐",
        content: $('#controlEditIndexBanner'),
        area:["500px","540px"],
        btn: ['确定', '取消'],
        yes: function(index, layero){
           alert("点击了确认");
          layer.close(index); 
        }
   });
})


//index_book
$("#addBookBt").click(function(){
   layer.open({
        type: 1,
        title:"添加书籍推荐",
        content: $('#controladdIndexbook'),
        area:["500px","400px"],
        btn: ['确定', '取消'],
        yes: function(index, layero){
           alert("点击了确认");
          layer.close(index); 
        }
   });
})

$("body").on("click","#index_bookTable .edit",function(){
    layer.open({
        type: 1,
        title:"修改推荐",
        content: $('#controlEditIndexbook'),
        area:["500px","440px"],
        btn: ['确定', '取消'],
        yes: function(index, layero){
           alert("点击了确认");
          layer.close(index); 
        }
   });
})


//count_book
$("#count_bookFilter").find('.tag').click(function() {
    $(this).siblings("span").removeClass('active');
    $(this).addClass('active');
}); 


var chart_book = echarts.init(document.getElementById('chart_book'));
var option_book = {
    title : {
        text: '书籍数占比',
        x:'center',
        textStyle:{
           color:"#333",
           fontWeight:"normal"
        }
    },
    tooltip : {
        trigger: 'item',
        formatter: "{b} : {c} ({d}%)"
    },
    legend: {
        data:['分类1','分类2','分类3','分类4'],
        bottom: 10
    },
    series : [
        {
            type: 'pie',
            radius : '55%',
            center: ['50%', '46%'],
            data:[
                {value:335, name:'分类1'},
                {value:310, name:'分类2'},
                {value:234, name:'分类3'},
                {value:135, name:'分类4'}
            ],
           label: { 
                formatter: '{b} {d}%'
           }
        }
    ]
};

chart_book.setOption(option_book);




var chart_read = echarts.init(document.getElementById('chart_read'));
var option_read = {
    title : {
        text: '阅读数占比',
        x:'center',
        textStyle:{
           color:"#333",
           fontWeight:"normal"
        }
    },
    tooltip : {
        trigger: 'item',
        formatter: "{b} : {c} ({d}%)"
    },
    legend: {
        data:['分类1','分类2','分类3','分类4'],
        bottom: 10
    },
    series : [
        {
            type: 'pie',
            radius : '55%',
            center: ['50%', '46%'],
            data:[
                {value:335, name:'分类1'},
                {value:310, name:'分类2'},
                {value:234, name:'分类3'},
                {value:135, name:'分类4'}
            ],
           label: { 
                formatter: '{b} {d}%'
           }
        }
    ]
};

chart_read.setOption(option_read);



var chart_collect = echarts.init(document.getElementById('chart_collect'));
var option_collect = {
    title : {
        text: '阅读数占比',
        x:'center',
        textStyle:{
           color:"#333",
           fontWeight:"normal"
        }
    },
    tooltip : {
        trigger: 'item',
        formatter: "{b} : {c} ({d}%)"
    },
    legend: {
        data:['分类1','分类2','分类3','分类4'],
        bottom: 10
    },
    series : [
        {
            type: 'pie',
            radius : '55%',
            center: ['50%', '46%'],
            data:[
                {value:335, name:'分类1'},
                {value:310, name:'分类2'},
                {value:234, name:'分类3'},
                {value:135, name:'分类4'}
            ],
           label: { 
                formatter: '{b} {d}%'
           }
        }
    ]
};

chart_collect.setOption(option_collect);